<template>
	<el-table :data="data" style="width: 100%;height: 100%;">
		<el-table-column prop="table" label="表名" width="180" />
		<el-table-column prop="status" label="最新标准化时间" />
		<el-table-column prop="isChanged" label="表结构是否改动" />
		<el-table-column label="标准化">
			<template #default="scope">
				<el-button type="primary" size="small" @click="$router.push({name:'aline', query:{table:scope.row.table}})">字段详情
				</el-button>
			</template>
		</el-table-column>
	</el-table>
</template>
  
<script setup>
import { onMounted, reactive } from 'vue'
import { useDatabase } from '@/stores/databaseStore'

const tableData = [
	{
		date: '2016-05-03',
		name: 'Tom',
		address: 'No. 189, Grove St, Los Angeles',
	},
	{
		date: '2016-05-02',
		name: 'Tom',
		address: 'No. 189, Grove St, Los Angeles',
	},
	{
		date: '2016-05-04',
		name: 'Tom',
		address: 'No. 189, Grove St, Los Angeles',
	},
	{
		date: '2016-05-01',
		name: 'Tom',
		address: 'No. 189, Grove St, Los Angeles',
	},
	{
		date: '2016-05-08',
		name: 'Tom',
		address: 'No. 189, Grove St, Los Angeles',
	},
	{
		date: '2016-05-06',
		name: 'Tom',
		address: 'No. 189, Grove St, Los Angeles',
	},
	{
		date: '2016-05-07',
		name: 'Tom',
		address: 'No. 189, Grove St, Los Angeles',
	},
]
const data = reactive([])

onMounted(() => {
	const database = useDatabase()
	for (let key in database.raw) {
		// console.log(database.raw[key])
		data.push({ table: key, status: database.raw[key].standar == 1 ? database.raw[key].standard_time : '未标准化', isChanged: '否' })
	}
	// console.log(data)
})
</script>